package com.tanhua.admin.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.tanhua.model.pojo.Log;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

public interface LogMapper extends BaseMapper<Log> {

    //新注册用户数
    @Select("select count(distinct user_id) count from  tb_log where type = #{type} and log_time = #{logTime}")
    Integer findCountByTypeAndLogTime(@Param("type") String type,@Param("logTime") String logTime);

    //活跃用户数
    @Select("select count(distinct user_id) count from tb_log where log_time = #{logTime}")
    Integer findCountByLogTime(@Param("logTime") String logTime);


    //次日留存用户数
    @Select("select count(distinct user_id) count from  tb_log where log_time = #{today} and user_id in (select user_id count from tb_log where log_time = #{yesterday} and type = '0102')")
    Integer findRetention1d(@Param("today") String today,@Param("yesterday")String yesterday);

}
